<template>
  <transition name="bounce">
    <div class="list-box">
      <div v-if="device !== 'small-desktop' && device !== 'mobile'" class="list-thumb" :style="{'background-image': 'url(' + coverurl(article.cover) + ')'}">
      </div>
      <div class="list-body">
        <h4 class="list-title">{{article.title}}</h4>
        <p class="list-description" >
          {{article.desc}}
        </p>
        <!-- <div class=""> -->
          <list-meta :author="article.author" :createAt="article.createAt" :love="article.love" :readingQuantity="article.readingQuantity"></list-meta>
        <!-- </div> -->
      </div>
    </div>
  </transition>
</template>

<script>
import { mapGetters } from 'vuex'
import unt from 'assets/unt.jpg'
import listMeta from 'base/articleList/meta.vue'
export default {
  name: 'list-box',
  data() {
    return {
      unt
    }
  },
  props: {
    article: {
      type: Object,
      default: {}
    }
  },
  components: {
    listMeta
  },
  methods: {
    coverurl(url) {
      return url || this.unt
    }
  },
  computed: {
    ...mapGetters([
      'device'
    ])
  }
}
</script>

<style lang="scss" scoped>
@import '~common/styles/mixin.scss';
@keyframes bounce-in {
  0% {
    transform: scale(0);
  }
  50% {
    transform: scale(1.5);
  }
  100% {
    transform: scale(1);
  }
}
.bounce-enter-active {
  animation: bounce-in .5s;
}
.bounce-leave-active {
  animation: bounce-in .5s reverse;
}
.list-box {
  display: flex;
  flex-direction: row;
  height: 134px;
  align-items: center;
  margin-bottom: 12px;
  cursor: pointer;
  background-color: rgba(255,255,255,0.4);
  transition: all 0.35s ease-out;
  .list-thumb {
    width: 170px;
    height: 120px;
    margin-left: 8px;
    overflow: hidden;
    background-position: center;
    background-size: cover;
  }
  .list-body {
    flex: 1;
    // max-width: 600px;
    width: 100%;
    margin: 0 12px;
    .list-title {
      margin: 0;
      max-width: 300px;
      width: 60%;
      margin-left: 2rem;
      height: 20px;
      line-height: 20px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .list-description {
      height: 60px;
      line-height: 20px;
      overflow: hidden;
      margin: 5px 0;
      font-size: 14px;
      @include clamp(3);
    }
  }
  &:hover {
    transform: scale(1.02);
    background-color: rgba(255,255,255,0.6);
  }
}
</style>
